I 'm trying to replace a template DOCX
document with Apache POI
by using the XWPFDocument
class. I have tags in the doc and a JSON
file to read the replacement data. My problem is that a text line seems separated in a certain way in DOCX
when I change its extension to ZIP
file and open document.xml
. For example [MEMBER_CONTACT_INFO]
text becomes [MEMBER_CONTACT_INFO
and ]
separately. POI
reads this in the same way since the DOCX
original is like this. This creates 2 XWPFRun
objects in the paragraph which show the text as [MEMBER_CONTACT_INFO
and ]
separately.
My question is, is there a way to force POI
to run like Word via merging related runs or something like that? Or how can I solve this problem? I 'm matching run texts while replacing and I can't find my tag because it is split into 2 different run object.
Best